package com.yxw.yxnet_cd_center.customer_service.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yxw.yxnet_cd_center.customer_service.dto.FlowRuleFitDTO;
import com.yxw.yxnet_cd_center.customer_service.entity.YxCsFlowRuleEntity;
import com.yxw.yxnet_cd_center.customer_service.entity.YxCsWorkflowEntity;
import com.yxw.yxnet_cd_center.customer_service.vo.YxCsWorkflowForUserVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author liuxin
 * @date 2023.09.13
 */
@Repository
public interface WorkflowMapper extends BaseMapper<YxCsWorkflowEntity> {


    /**
     * 新增分流规则
     * @param entity
     * @return
     */
    Long addWorkflowRule(YxCsFlowRuleEntity entity);

    /**
     * 新增规则人员信息
     * @param ruleId
     * @param userIdList
     */
    void addFlowRuleUser(@Param("ruleId")Long ruleId,@Param("list") List<Long> userIdList);

    /**
     * 渠道+端口+服务类型+规则组成的工作流只存在一个群
     * @param channelId
     * @param portId
     * @param serviceType
     * @param fitList
     * @return
     */
    String validataRule(Long channelId, Long portId, Long serviceType, List<FlowRuleFitDTO> fitList);


    List<YxCsWorkflowForUserVo> getWorkflowListForUser(@Param("userName") String userName,
                                                       @Param("portCode") String portCode,
                                                       @Param("channelCode") String channelCode,
                                                       @Param("serviceTypeCode") String serviceTypeCode,
                                                       @Param("ruleTypeCode") String ruleTypeCode,
                                                       @Param("flockName") String flockName,
                                                       @Param("groupName") String groupName,
                                                       @Param("flowName") String flowName);
}
